<?php $sidebar_ads = ot_get_option('op_sidebarbanner', array());
$current_term = get_queried_object();
$top_term_id = Azio_Posts::getTopParentTermId($current_term->term_id);
$terms = get_terms('producttype', 'orderby=id&hide_empty=0&parent='.$top_term_id);?>
<div id="column-left" class="grid_3 aside">
    <div class="box">
        <div class="box-heading">Danh mục</div>
        <div class="box-content">
            <div class="box-category">
                <ul>
                    <?php foreach ($terms as $term):
                        $term_link = get_term_link($term, 'producttype');?>
                        <li>
                            <a href="<?php echo $term_link ?>" title="<?php echo esc_attr($term->name) ?>"><?php echo $term->name ?></a>
                        </li>
                    <?php endforeach ?>
                </ul>
            </div>
        </div>
    </div>

    <?php if (!empty($sidebar_ads)) {
        foreach ($sidebar_ads as $sidebar_ad) {
            ?>
            <div class="banner">
                <span class="cover"></span>
                <img src="<?php echo $sidebar_ad['image'] ?>" alt="<?php echo esc_attr($sidebar_ad['title']) ?>" width="198"/>
                <a class="icomoon link-icon" aria-hidden="true" data-icon="&#xe000;" href="<?php echo $sidebar_ad['link'] ?>"></a>
            </div>
        <?php
        } // end foreach
    } //end if
    ?>

</div>
<!-- end #column-left -->